use actix_web::{get, web};
use rusqlite::Connection;
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
struct Info {
    id: i32
}

#[get("/student/delete")]
pub async fn delete_student(info: web::Query<Info>) -> String {
    let conn = Connection::open("./data/data.db").expect("curd/student/delete.rs | pub async fn delete_student() -> 数据库连接失败！");
    conn.execute("DELETE FROM student WHERE id = ?", [info.id]).expect("curd/student/delete.rs | pub async fn delete_student() -> 删除失败！");

    format!("delete student id: {}", info.id)
}